package com.sizu.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.sizu.entity.TPurchaseList;
import com.sizu.mapper.TPurchaseListMapper;
import com.sizu.service.ITPurchaseListService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 赵玉玺
 * @since 2020-03-16
 */
@Service
public class TPurchaseListServiceImpl extends ServiceImpl<TPurchaseListMapper, TPurchaseList> implements ITPurchaseListService {

    @Override
    public boolean upTPurchaseListState(String number) {
        Wrapper<TPurchaseList> tPurchaseListWrapper=new EntityWrapper<>();
        tPurchaseListWrapper.eq("purchase_number",number);
        TPurchaseList tPurchaseList=new TPurchaseList();
        tPurchaseList.setState(2);
        this.baseMapper.update(tPurchaseList,tPurchaseListWrapper);
        return true;
    }

    @Override
    public List<TPurchaseList> getTPurchaseList() {
        Wrapper<TPurchaseList> tPurchaseListWrapper=new EntityWrapper<>();
        tPurchaseListWrapper.eq("state","1");
        List<TPurchaseList> tPurchaseLists = this.baseMapper.selectList(tPurchaseListWrapper);
        return tPurchaseLists;
    }
}
